package Algorithm;

public class Day09 {
    public static void main(String[] args) {
        String s = "a good   example";
        if (s == null) {
            System.out.println();
        }

        StringBuffer res = new StringBuffer();
        String[] tmp = s.split("\\s+");
        int left = 0;
        int right = tmp.length - 1;
        for (int i = 0; i < tmp.length; i++) {
            if(i < tmp.length / 2) {
                swap(left, right, tmp);
            }
            left++;
            right--;
            res.append(tmp[i]);
            res.append(" ");
        }
        System.out.println(res.toString());
    }

    public static void swap(int left, int right, String[] reTmp) {
            String t = reTmp[left];
            reTmp[left] = reTmp[right];
            reTmp[right] = t;
    }

}
